#include "StringSeq.h"
#include "CjTypeWrapper.h"
#include "WrapFactory.h"
namespace clojure_lang {

StringSeq::StringSeq()
{
}
StringSeq::StringSeq(IPersistentMap *meta, QString &st, int idx):ASeq(meta)
{
    s = st;
    i = idx;

}

CjObject *StringSeq::first()
{
    return wrap(s.at(i));
}

int StringSeq::count()
{
    return s.length() - i;
}

int StringSeq::index()
{
    return i;
}

ISeq *StringSeq::next()
{
    if (i + 1 < s.length())
        return new StringSeq(meta(), s, i+1);
    return NULL;

}

CjObject *StringSeq::withMeta(IPersistentMap *meta)
{
    if (meta == _meta)
        return this;
    return new StringSeq(meta, s, i);
}

StringSeq *StringSeq::create(QString &s)
{
    if (s.length() == 0)
        return NULL;
    //return NewRef(StringSeq, (IPersistentMap_(NULL), s, 0));
    return new StringSeq(NULL, s, 0);
}

StringSeq *StringSeq::create(const char *s)
{
    QString qs = QString(s);
    return StringSeq::create(qs);
}
}
